<template>
	<gui-page ref="guiPage" :customHeader="true">
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('distributedEnter.scanRecord')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="data.scanList.length==0" class="noticeHooks">
				{{data.scanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without')}}
			</view>
			<view class="record-card" v-for="(x,i) in data.scanList" :key="i" v-else>
				<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30" @click="deleteItem(i,x)"></uni-icons>
				<view class="card-mini-head">
					<view class="title-line"></view>
					<text>{{$t('translationImage.serialNumber')}}：{{data.scanList.length-i}}</text>
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedOut.barcode')}}：</text>{{x.barcode}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialCode')}}：</text>{{x.materialCode}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialName')}}：</text>{{x.materialName}}
				</view>
<!-- 				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedOut.palletQRCode')}}：</text>{{x.barcode}}
				</view> -->
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.qty')}}：</text>{{x.currentQty}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('translationImage.traySize')}}：</text>{{x.qrCode}}
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
	import {
		computed,
		reactive,
		onMounted
	} from 'vue'
	import { basPdaOperationLogFn } from '@/utils/index.js';
	import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'
	import {
		useStore
	} from "vuex";
	let store = useStore();
	let data = reactive({})
	data.scanList = computed(() => {
		return store.state.k3distributedOutData
	})
	onMounted(() => {
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(data.scanList)
			let operationPicture = '分布式调出'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_LOOK,
				module:'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
	})
	const deleteItem = (index,item) => {
		try {
			let inputParameter = JSON.stringify(item)
			let returnParameter = '无'
			let operationPicture = '分布式调出'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_DEL,
				module:'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		store.commit('deleteK3DistributedOutData',index)
	}
</script>

<style>

</style>
